       <?php
	   $row = $result[0];
	   $lg ='vi';
	      $info =  unserialize($row['page_info']);
		  	$content = unserialize($row['page_content']);
		     
	   	 if($num_lang >1)  $row_en = $result[1];
	//print_r($row);
	    echo form_open_multipart('admin/pages/update/'.$row['page_cat'].'/'.$row['page_id']); ?>	<!-- start title -->
		<div class="title corners_top" style="float:left;width:200px;"><h6 style="color:#900;" id="forms"><?php echo $title; ?></h6></div><!-- end title -->
        		<div class="proccess_bar">
    <ul class="menu_bar">
    <li><?php
	$data = array('name' => 'update', 'value' => ' ','class'=>'delete-1', 'id' => 'save');
	 echo form_submit($data);?> <!--<a href="#" ><span class="save-1"> </span>Save</a> -->
     Lưu
     </li>
     <li> <?php 
	 $data = array('name' => 'close', 'value' => ' ','class'=>'delete-1', 'id' => 'cancel');
	 echo form_submit($data); ?>
     Hủy<!--<a href="#" ><span class="cancel-1"></span>Cancel</a>--></li>
    </ul>
 </div>
		<div class="content">
        
       
        <?php // echo '<p class="title">'.$this->lang->line('title_user_info').'</p>';
 if(isset($missing) && is_array($missing) )
   {
  
   echo ' <div><a href="javascript:();" title="Succes box" class="box error corners"><span class="close">&nbsp;</span>';
   foreach($missing as $item)
   {
   		echo $item."<br />";
   }
   echo "</a></div>";
   }
	?>
     <h6><?php echo $label =$this->lang->line('image'); ?></h6>
		<input type="text" id="fileName" class="file_input_textbox corners_left" value="<?php echo $row['page_image']?>" readonly="readonly" /> 
 			<div class="file_input_div">
				<input type="button" value="" class="file_input_button" />
				
               <input type="file" name="img" id="img" class="file_input_hidden"  onchange="javascript: document.getElementById('fileName').value = this.value" />
			</div>
            <?php if($row['page_image'] !=""){?>
            <img width="200x;" src="<?php echo base_url()."upload/pages/".$row['page_image']?>"/><br />
			<a style="padding-left:10px" href="<?php echo base_url()."index.php/admin/pages/deleteimage/".$row['page_cat']."/".$row['page_id']?>"  ><font color="#990000" >Xóa ảnh</font></a> 
            <?php }?>

     <?php 
//  $option[] = '--- Chọn Loại --- ';
  	
		 //$i =1;
		  $option[] = '--- Chọn chủ đề --- ';
  	 if(!empty($cat))
	 {
		 foreach($cat as $item)
		 {
			 $option[$item['cat_id']]= $item['cat_name'];
		 }
	 }
	 
  echo '<div >';
  	echo '<h3>',form_label('Chủ đề'),'</h3>', form_dropdown('cate',$option,$row['page_cat']);
	echo '</div>';
	
	echo '<div style="clear:left"></div>';
  ?>
  
  


<h6 ><?php echo $this->lang->line('news_title'); ?></h6>
<?php
		//title  vi
//$title = unserialize($row['page_name']);


echo '<div class="inner">';
	$code = "title_vi";
	$label ="Vietnamese".' <font color="red" style="font-weight:bold">(*)</font>';
	$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code, 'value' => html_entity_decode($row['page_name'],ENT_QUOTES,"UTF-8") ) ;
	echo '<p>';
	echo form_label($label);
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

	else
	  echo form_input($data, set_value($code));
	
	echo '</p>';
	
	if($num_lang >1)
	{
	//title en

	echo '<div class="inner">';
	$code = "title_en";
	$label ="English".' <font color="red" style="font-weight:bold">(*)</font>';

	
		

	$data = array('name' =>$code,'class'=>'large_input corners',  'value' => html_entity_decode($row['page_name'],ENT_QUOTES,"UTF-8"));
	
	echo '<p>';
	echo form_label($label);
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

	else
	  echo form_input($data, set_value($code));
	
	echo '</p>';
	
	echo '</div>';


	}
//	echo '</div>';

	

?>

<h6><?php echo "Giới thiệu ngắn" ?></h6> 
<?php

			//direction vietname
$code = "direction_vi";
	$label ="Vietnamese";
	echo '<div class="inner">';

		
	$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code, 'value' => html_entity_decode($info['vi'],ENT_QUOTES,'UTF-8'));
if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>''));

	else

		echo $label;
	echo '<div class="textarea"> '.form_textarea($data).'</div>';

	echo '</div>';
	
		if($num_lang > 1)
{
	
		//direction english
$code = "direction_en";
	$label ="English";
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

				echo $label;

	$data = array('name' =>$code, 'id' => $code,'class'=>'large_input corners', 'value' => $info['en']);

	echo '<div class="textarea">'.form_textarea($data).'</div>';

	echo '</div>';
	
}
	

?>


<h6><?php echo "Nội dung"?></h6>
<?php

	
		//detailed_content vietnamese
$code = "detailed_content_vi";
	$label ="Vietnamese";
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>''));


	else

				echo $label;
	
	
	$data = array('name' =>$code, 'id' => $code,'value' => html_entity_decode($content[$lg],ENT_QUOTES,'UTF-8'));

	echo '<div class="textarea">'.form_textarea($data).'</div>';

	echo '</div>';
	
		if($num_lang > 1)
{
		//detailed_content english
$code = "detailed_content_en";
	$label ="English";
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, array('class'=>''));

	else

				echo $label;

	$data = array('name' =>$code, 'id' => $code, 'value' => $detail['en']);

	echo '<div class="textarea" style="">'.form_textarea($data).'</div>';

	echo '</div>';
	
}

	?>
    <h6 style="clear:left;float:left;height:30px;width:120px;margin-top:5px;" > Trạng thái </h6>
<div style="float:left;margin-top:5px;height:30px;" >
<input  type="radio" name="status" id="status" value="1" <?php echo ($row['page_status']==1)? 'checked="checked"':'' ?> />Hiện
<input  type="radio" name="status" id="status" value="0" <?php echo ($row['page_status']==0)? 'checked="checked"':'' ?> /> ẩn
</div>
    <?php

	echo form_close(); //FORM END

	//echo $num_lang;
	
	?> 
        
        
  <script type="text/javascript">

// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
	document.write(
		'<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
		'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
		'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
		'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
		'value (line 32).' ) ;
}
else
{

	var editor =		CKEDITOR.replace("direction_vi");
	var editor_detail =		CKEDITOR.replace("detailed_content_vi");
	<?php  if($num_lang >1) {echo 'var editor2 = CKEDITOR.replace("direction_en");';
	echo 'var editor_detail2 = CKEDITOR.replace("direction_content_en");';
	}
	?>

	//editor.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor2.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor3.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	// Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
	// The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
	CKFinder.setupCKEditor( editor,'<?php echo base_url(); ?>public/scripts/admin/ckfinder') ;  //'../../../../../public/scripts/admin/ckfinder') ;
CKFinder.setupCKEditor( editor_detail,'<?php echo base_url(); ?>public/scripts/admin/ckfinder') ; 
<?php  if($num_lang >1){ echo "CKFinder.setupCKEditor( editor2, '".base_url()."public/scripts/admin/ckfinder') ;";
echo "CKFinder.setupCKEditor( editor_detail2, '".base_url()."public/scripts/admin/ckfinder') ;";
}?>
	// It is also possible to pass an object with selected CKFinder properties as a second argument.
	// CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}

		</script>


